package com.seehope.outputstream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class Demo1 {

	public static void main(String[] args) {
		//demo1();
		demo2();
	}

	private static void demo1() {
		
		try {
			OutputStream out=new FileOutputStream("c:/test.txt");
			out.write(72); // H
			out.write(101); // e
			out.write(108); // l
			out.write(108); // l
			out.write(111); // o

			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	private static void demo2() {
		
		try {
			OutputStream out=new FileOutputStream("c:/test.txt");
			System.out.println("Hello".getBytes());
			out.write("Hello".getBytes());

			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}


}
